package com.kaifamiao.base.Demo210815;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 班级类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Classes {
    private String name;
    private String majorName;
    private Student[] students;

    public Classes(String name, String majorName) {
        this.name = name;
        this.majorName = majorName;
    }

    public static void main(String[] args) {
        Classes classes = new Classes("计算机二班", "计算机科学与技术");
        Course java = new Course("Java", "8968");
        Course python = new Course("Python", "7548");
        Score s1JavaScore = new Score(java, 98.8, new Date(2021 - 10 - 22));
        Score s1PythonScore = new Score(python, 86.9, new Date(2022 - 1 - 22));
        Score s2JavaScore = new Score(java, 99.9, new Date(2021 - 11 - 22));
        Score s2PythonScore = new Score(python, 86.9, new Date(2022 - 2 - 22));
        Student s1 = new Student("张三", "男", "P123",
                new Score[]{s1JavaScore, s1PythonScore});
        Student s2 = new Student("李四", "男", "P456",
                new Score[]{s2JavaScore, s2PythonScore});
        classes.setStudents(new Student[]{s1, s2});
        System.out.println(classes);
    }

}

/**
 * 学生类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
class Student {
    private String name;
    private String gender;
    private String sNumber;
    private Score[] scores;
}

/**
 * 成绩类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
class Score {
    private Course course;
    private double score;
    private Date time;
}

/**
 * 课程类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
class Course {
    private String name;
    private String code;
}